Skip to content

feat(list): add advanced linked list algorithms (reverse, swap pairs, rotate) with tests#1

Open
cto-new[bot] wants to merge 1 commit intodevfrom
feat-add-linked-list-algorithms
Open

feat(list): add advanced linked list algorithms (reverse, swap pairs, rotate) with tests#1
cto-new[bot] wants to merge 1 commit intodevfrom
feat-add-linked-list-algorithms

Conversation

@cto-new
Copy link

@cto-new cto-new bot commented Oct 20, 2025

Summary

This PR adds several widely used linked list algorithms for the doubly-linked list implementation, including reverse, in-place reverse, pairwise swapping, and cyclic rotation, along with comprehensive tests for each algorithm.

Details

  • Added Reverse, ReverseSelf, SwapPairs, RotateLeft, and RotateRight functions for LinkedList in linked_list_algo.go.
  • Each new function includes detailed comments on usage and algorithmic complexity.
  • Created linked_list_algo_test.go providing high-coverage unit tests for all new algorithms, covering edge cases and typical scenarios.
  • All additions are non-breaking and backward-compatible for library users.

Adds several common linked list algorithms including full reverse (with new list),
in-place reverse, pairwise node swap, and cyclic rotate left/right. These are bundled
under `linked_list_algo.go` with comprehensive test coverage in `linked_list_algo_test.go`.
This enhancement provides essential utilities for list data manipulation, aligning
with typical algorithmic expectations and improving reusability of the linked list.
No breaking changes. Migration is not required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants